#!/usr/bin/env pytho      
# -*- coding: utf-8 -*-
# @Author  : junpeng_chen
# @Time    : 2023/7/26 9:48
# @File    : log.py
# @annotation    : 公共日志模块

"""Log config"""
import logging
import os
import codecs


class UTF8FileHandler(logging.FileHandler):
    def __init__(self, filename, mode='a', encoding='utf-8', delay=False):
        super(UTF8FileHandler, self).__init__(filename, mode, encoding, delay)


root = os.path.abspath(os.path.dirname(__file__))
filepath = os.path.join(root, 'app.log')
logging.basicConfig(
    level=logging.ERROR, # 原本是debug
    handlers=[UTF8FileHandler(filepath, encoding='utf-8')],
    format='%(levelname)s - %(asctime)s - %(filename)s - %(message)s'
)

logger = logging.getLogger()
